<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
    <script src="./js/axios.js"></script>
    <script>
      
        try{
           var token = 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OCwidXNlcm5hbWUiOiJ5YXN1b3p1aWt1IiwicGFzc3dvcmQiOiIiLCJuaWNrbmFtZSI6bnVsbCwiZW1haWwiOm51bGwsInVzZXJfcGljIjoiIiwiaWF0IjoxNjE2MTUzNTc0LCJleHAiOjE2MTYxODk1NzR9.DxmqM639mj4OiOtknbkFga5r2CqlLKloQSdAB5O9Uk8'
           axios.defaults.headers.Authorization = token
           axios.defaults.baseURL='http://127.0.0.1:8000'
            let promise = new Promise((resolve,reject) => {
            axios({
                method:'GET',
                url:'/my/article/cates',
                SetHeader:{
                    'content-type':'application/json'
                },
            })
            .then( res => {
                if(res.data.message === "获取文章分类列表成功！"){
                    resolve('获取文章分类成功')
                } else {
                    reject()
                }
                console.log(res.data);
            })

        }).then( resolve => {
            console.log(resolve);
        }).catch( reject => {
            console.log(reject);
        } )
        }catch(ex){
            console.log(ex);
        }


    //    function fn(url){
    //     axios({
    //             method:'post',
    //             url:url,
    //             SetHeader:{
    //                 'content-type':'application/json'
    //             },
    //             data:{
    //                 name:'wnnnnnnnnn',
    //                 password:'123456'
    //             }
    //         })
    //    }
    //    let f1 = fn('/api/reguser')
    //    let f2 = fn('/api/login')
    //    const p1 = Promise.all([f1,f2])
    //    p1.then( res => {
    //         console.log(112222);
    //   })
      
    </script>
</body>
</html>